package com.example.za.account.model;

import android.os.Parcel;
import android.os.Parcelable;

import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;

import cn.bmob.v3.BmobUser;

/**
 * 用户实体类
 */

@DatabaseTable(tableName = "ASuser")
public class User extends BmobUser implements Parcelable {

    @DatabaseField(generatedId = true, columnName = "ASid")
    private int mId;
    @DatabaseField(columnName = "ASname")//昵称
    private String mName;
    @DatabaseField(columnName = "ASpassword")//密码
    private String pass;
    @DatabaseField(columnName = "ASemail")//邮箱
    private String eMail;
    @DatabaseField(columnName = "ASphoto")//头像
    private String mPicture;

    public User() {

    }

    public User(String mName, String pass, String eMail, String mPicture) {
        this.mName = mName;
        this.pass = pass;
        this.eMail = eMail;
        this.mPicture = mPicture;
    }

    public int getmId() {
        return mId;
    }

    public void setmId(int mId) {
        this.mId = mId;
    }

    public String getmName() {
        return mName;
    }

    public void setmName(String mName) {
        this.mName = mName;
    }

    public String getPass() {
        return pass;
    }

    public void setPass(String pass) {
        this.pass = pass;
    }

    public String geteMail() {
        return eMail;
    }

    public void seteMail(String eMail) {
        this.eMail = eMail;
    }

    public String getmPicture() {
        return mPicture;
    }

    public void setmPicture(String mPicture) {
        this.mPicture = mPicture;
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.mId);
        dest.writeString(this.mName);
        dest.writeString(this.pass);
        dest.writeString(this.eMail);
        dest.writeString(this.mPicture);
    }

    protected User(Parcel in) {
        this.mId = in.readInt();
        this.mName = in.readString();
        this.pass = in.readString();
        this.eMail = in.readString();
        this.mPicture = in.readString();
    }

    public static final Creator<User> CREATOR = new Creator<User>() {
        @Override
        public User createFromParcel(Parcel in) {
            return new User(in);
        }

        @Override
        public User[] newArray(int size) {
            return new User[size];
        }
    };

    @Override
    public String toString() {
        return "User{" +
                "mId=" + mId +
                ", mName='" + mName + '\'' +
                ", pass='" + pass + '\'' +
                ", eMail='" + eMail + '\'' +
                ", mPicture='" + mPicture + '\'' +
                '}';
    }
}
